import EventEmitter from "eventemitter3";

export class Game_Temp extends EventEmitter{
    constructor() {
        super();
        this._isPlaytest = false;//Utils.isOptionValid('test');
        this._commonEventId = 0;
        this._destinationX = null;
        this._destinationY = null;
    }

    isPlaytest() {
        return this._isPlaytest;
    }

    reserveCommonEvent(commonEventId) {
        this._commonEventId = commonEventId;
    }

    clearCommonEvent() {
        this._commonEventId = 0;
    }

    isCommonEventReserved() {
        return this._commonEventId > 0;
    }

    reservedCommonEvent() {
        return $dataCommonEvents[this._commonEventId];
    }

    setDestination(x, y) {
        if(this._destinationX!=x||this._destinationY!=y){
            this._destinationX = x;
            this._destinationY = y;
            this.emit('temp:destionation','active');
        }
    }

    clearDestination() {
        this._destinationX = null;
        this._destinationY = null;
        this.emit('temp:destionation','deactive');
    }

    isDestinationValid() {
        return this._destinationX != null;
    }

    destinationX() {
        return this._destinationX;
    }

    destinationY() {
        return this._destinationY;
    }
}